import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
    /** 暂时先加.vue, .js, .json */
    extensions: [".vue", ".js", ".json"],
  },
  server:{
    host:'0.0.0.0',
    port:'8010',
    proxy:{
      '/api':'http://10.176.44.77:9090',
      '/phmApi': {
        target: 'http://10.173.184.131:9090/phmApi',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/phmApi/, ''),
      },
      // Proxying websockets or socket.io: ws://localhost:5173/socket.io -> ws://localhost:5174/socket.io

    }
  }
})
